'''
   请设计一个装饰器，它可以作用在任何函数上，打印函数执行时间：

'''
import time
import datetime
def metric(fn):   # 定义一个装饰器  打印函数运行时间
    start_time = datetime.datetime.now()
    fn()
    end_time = datetime.datetime.now()
    run_time = end_time - start_time
    print('%s  executed in %s ms' % (fn.__name__, run_time.microseconds))
    print('%s  executed in %s s' % (fn.__name__, run_time.seconds))
    print('%s  executed in %s s' % (fn.__name__, run_time))
@metric
def fun():
    # from moduleone_1.第一周作业.作业一乘法表.for_in_1 import multiply_table
    # return multiply_table
    time.sleep(1)
